package scm.erp.core.auth;

//import com.alibaba.ttl.TransmittableThreadLocal;


import com.alibaba.ttl.TransmittableThreadLocal;

public class SSOContext {
    private static final TransmittableThreadLocal<LoginSession> THREAD_LOCAL = new TransmittableThreadLocal<>();

    public static LoginSession set(LoginSession userSession) {
        THREAD_LOCAL.set(userSession);
        return userSession;
    }


    public static LoginSession getUserSession() {
        LoginSession userSession = THREAD_LOCAL.get();
        if (userSession == null) {
            userSession = new LoginSession();
            THREAD_LOCAL.set(userSession);
        }
        return userSession;
    }
}
